package com.yhos.platform.oopston.core.messagesource;

import com.yhos.platform.oopston.core.utils.MessageSourceUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;

@Configuration
public class MessageSourceConfig {

    @Bean
    public ResourceBundleMessageSource messageSource() {
        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
        messageSource.setBasename("resource.messageResource");
        messageSource.setDefaultEncoding("UTF-8");
        return messageSource;
    }

    @Bean
    public MessageSourceUtils messageSourceUtils() {
        MessageSourceUtils messageSourceUtils = new MessageSourceUtils();
        messageSourceUtils.setMessageSource(this.messageSource());
        return messageSourceUtils;
    }
}
